package com.cn.yunhe.struts.controller;

import com.cn.yunhe.struts.modle.User;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class First extends ActionSupport implements ModelDriven<User>{
	//�����з�װһ��ʵ���࣬����ʵ��ModelDriven�ӿڣ����ܵ������е����ԣ�������ʵ�ַ���getModel();
	//����д�ĺô��ǲ���Ҫ��jsp�ļ���ȡ������ֵ��ʱ�������User.username
	private User user;
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

	private String message;
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	
	public String execute() throws Exception{
		
		System.out.println("������"+user.getUsername()+"���룺"+user.getUserpwd());
		if("��С��".equals(user.getUsername()) && "123".equals(user.getUserpwd())){
			this.setMessage("��½�ɹ���");//setMessage()�൱��request
			return SUCCESS;

    	}
    	
        this.setMessage("��½ʧ�ܣ�");
        return SUCCESS;
	}
	public User getModel() {
		// TODO Auto-generated method stub
		if(user==null){
			user=new User();
		}
		return user;
	}
public User  foodUser(){
		
		return user;
		
	}
		

}
